<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;
use App\User;

class FormRecord extends Model
{
    //
    protected $dates = ['deleted_at'];
    public $timestamps = true;
    protected $dateFormat = 'Y-m-d H:i:s';
    const CREATED_AT = 'created_at';
    const UPDATED_AT = 'updated_at';
    protected $table = 'form_records';
    protected $primaryKey = 'form_record_id';
    protected $fillable = [
        'form_id',
        'version',
        'title',
        'serial_number',
        'is_draft',
        'submitted_at',
        'submitted_by',
        'created_by',
        'updated_by',
        'deleted_by',
        'status',
        'next_to',
        'and_or',
        'step',
        'is_settle',
        'payer',
        'payee',
        'amount',
        'amount_unit',
        'sup_form_record_id',
        'end_time',
        'delay_to',
        'end_time_new',
        'is_task',
    ];
    //获取任务审核人
    public function superPeople(){

//        echo $this->morphToMany(User::class,'userable','userables','userable_id','user_user_id')->select(User::$colsList)->toSql();
//        die;
       //return $this->morphToMany(User::class,'userable','userables','userable_id','user_user_id')->select(User::$colsList);
        return $this->morphToMany(User::class, 'userable', 'userables', 'userable_id', 'user_user_id')
            ->select(User::$colsList)->withPivot(['step', 'created_at', 'created_by', 'to_object']);
    }
    //测试

}
